
public class Court
{
	public static final int LEFT_ZONE_END = 10;
	public static final int MID_ZONE_END = 20;
	public static final int RIGHT_ZONE_END = 30;
	public static final int OPPONENTS_BACK_ROW_END = 20;
	public static final int MID_LINE = 30;
	public static final int FRIENDLY_BACK_ROW_END = 40;
	public static final int COURT_END = 60;
	
	//Return 1-6 for the zone, - for opponent's zone, + for friendly
	//0 means error
	public static int getZone(int[] coordinates)
	{
		if (coordinates[0] < LEFT_ZONE_END)
		{
			//Could be in zone -1, -2, 4, or 5
			if (coordinates[1] < OPPONENTS_BACK_ROW_END)
			{
				//Zone -1
				return -1;
			}
			else if (coordinates[1] < MID_LINE)
			{
				//Zone -2
				return -2;
			}
			else if (coordinates[1] < FRIENDLY_BACK_ROW_END)
			{
				//Zone 4
				return 4;
			}
			else if (coordinates[2] < COURT_END)
			{
				//Zone 5
				return 5;
			}
			else
			{
				return 0;
			}
		}
		else if (coordinates[0] < MID_ZONE_END)
		{
			//Could be in zone -6, -3, 3, 6
			if (coordinates[1] < OPPONENTS_BACK_ROW_END)
			{
				//Zone -6
				return -6;
			}
			else if (coordinates[1] < MID_LINE)
			{
				//Zone -3
				return -3;
			}
			else if (coordinates[1] < FRIENDLY_BACK_ROW_END)
			{
				//Zone 3
				return 3;
			}
			else if (coordinates[2] < COURT_END)
			{
				//Zone 6
				return 6;
			}
			else
			{
				return 0;
			}
		}
		else if (coordinates[0] < RIGHT_ZONE_END)
		{
			//Could be in zone -5, -4, 2, 1
			if (coordinates[1] < OPPONENTS_BACK_ROW_END)
			{
				//Zone -5
				return -5;
			}
			else if (coordinates[1] < MID_LINE)
			{
				//Zone -4
				return -4;
			}
			else if (coordinates[1] < FRIENDLY_BACK_ROW_END)
			{
				//Zone 2
				return 2;
			}
			else if (coordinates[2] < COURT_END)
			{
				//Zone 1
				return 1;
			}
			else
			{
				return 0;
			}
		}
		else 
		{
			return 0;
		}
	}
}
